package cn.liutao.upload.api;

import cn.liutao.auth.entity.po.User;
import cn.liutao.common.entity.LoginUser;
import cn.liutao.common.enums.CommonEnum;

import javax.servlet.annotation.WebServlet;

/**
 * @author: liutao
 * @description: 用户头像上传通用接口
 * @date: 2023/11/23 22:18
 */
@WebServlet("/upload/avatar")
public class AvatarUploadServlet extends UploadServlet {
    private String path = CommonEnum.AVATAR_UPLOAD_DIRECTORY.getValue();

    /**
     * 具体上传文件路径
     * @return
     */
    @Override
    public String getUploadPath(String uploadPath) {
        User loginUser = LoginUser.getLoginUser();
        String username = loginUser.getUsername();
        return uploadService.concat(path,username);
    }


}
